/*****************************************************
PROJECT:  BRIDGE C2 
PILOT: SCRAP
DATE: 9/15/2022
   rerun 12/14/2023 on deduplicated denominator;


PROJECT DESCRIPTION: Use ASCEND approach to compare CRC, BC and 
BC cancer prevention services in patients with
	No SDH Screening
	Documented Need
	Documented No Need
Stratified by SDH need: Food, Housing, Transportation
STUDY PERIOD: 7/1/2016-2/29/2020		

DETAILS (this file): 
Table 1 for BC
    Patients
	Race and ethnicity
	Preferred language
	Age at Index encounter (median, range)
	Age Group at Index
	Payer at Index
	FPL 
	Visit per Year
	Years of Observation
	BC status at Index
	Last BC screen type prior to Index
	Years of Observation after first Due date
	Ever due for screening during observation	
Columns Food Insecurity: Need/ No Need/ Not documented
Columns Housing Insecurity: Need/ No Need/ Not documented
Columns Transportation Insecurity: Need/ No Need/ Not documented
		

INPUT DATA:
SCRAP.BC_patient_covariates;
SCRAP.BC_status_at_index;


****************************************************/
options compress=yes reuse=yes;
libname SCRAP "e:\\sasroot\BRIDGE C2\SCRAP\";
libname final "e:\\sasroot\BRIDGE C2\SCRAP\BC_table_1";
libname RD odbc noprompt="dsn=research_dev;Trusted_Connection=yes" bulkload=yes;
/****************************************************/

data analysis;
set SCRAP.crc_patient_covariates;
rename sdh_transportation=sdh_trans;
run;
data status_index;
set SCRAP.crc_status_at_index;
rename sdh_transportation=sdh_trans;
run;

/*Headers setting dynamic variables*/
%let cancer=crc;
/*************************************************
STEP 1: 
Uncomment lines 119-121
Run full progarm to generate food_insecurity numbers
**************************************************/
%let sdh=SDH_food;

%let sdh=SDH_housing;

%let sdh=SDH_trans;

proc freq data=analysis;
tables sex_r*&sdh/norow nopercent nofreq ;
run;

proc freq data=analysis;
tables race_ethnic*&sdh/norow nopercent nofreq;
run;

/*	Preferred language*/

proc freq data=analysis;
tables english*&sdh/norow nopercent nofreq;
run;



/*	Age Group at Index*/

proc freq data=analysis;
tables age_cat*&sdh/norow nopercent nofreq;
run;



/*	Payer at Index*/

proc freq data=analysis;
tables payor_type_research*&sdh/norow nopercent nofreq;
run;



/*	FPL */

proc freq data=analysis;
tables FPL_cat*&sdh/norow nopercent nofreq; ;
run;


/*	Visit per Year*/


proc freq data=analysis;
tables visit_cat*&sdh/norow nopercent nofreq;
run;


run;


/*	Years of Observation*/

proc freq data=analysis;
tables obs_cat*&sdh/norow nopercent nofreq;
run;



proc freq data=SCRAP.CRC_analysis;
tables FIT_FOBT_prior*&sdh/norow nopercent nofreq;;
run;

proc freq data=SCRAP.CRC_analysis;
tables imaging_prior*&sdh/norow nopercent nofreq;;
run;


/*	 status at Index*/
proc freq data=status_index;
tables status_at_index*&sdh/norow nopercent nofreq;
run;



/*	Ever due for screening during observation	*/
proc freq data=status_index;
tables ever_due*&sdh/norow nopercent nofreq;;
run;


proc freq data=SCRAP.CRC_analysis;
tables FIT_FOBT_prior/;
run;

proc freq data=SCRAP.CRC_analysis;
tables imaging_prior;
run;
proc freq data=analysis;
tables race_ethnic english age_cat
payor_type_research FPL_cat visit_cat
obs_cat/norow nocol nopercent;
run;



proc freq data=status_index;
tables status_at_index ever_due;
run;



proc freq data=status_index;
tables status_at_index ever_due/norow nocol nopercent;
run;
